package com.wd.live.model.base


import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModel
import androidx.viewbinding.ViewBinding


/**
 * 作者：马海钊
 * 时间：2023/8/15 11:01
 * 功能：
 */
abstract class BaseFragment <VM : ViewModel,DBD : ViewBinding>:Fragment(){
    private lateinit var _binding:DBD
    protected val binding get() = _binding;
    protected lateinit var viewModel: VM
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _binding=getViewBinding()
        return _binding.root
    }

   protected abstract fun getViewBinding(): DBD
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initData()
    }

    protected abstract fun initData()
}